package reflect;

/**
 * 用于测试反射机制
 */
@AutoRunClass//内部定义修饰类上
public class Person {

    private String name = "周桑";
    private int age = 18;

    public Person() {}

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }
    @TestMethod(5)//内部定义修饰方法上
    public void sayHi(){
        System.out.println(name+":你好...");
    }
    @TestMethod()
    public void sayHello() {
        System.out.println(name + ":大家好!");
    }
    @TestMethod(2)
    public void sayGoodBye() {
        System.out.println(name + ":再见");
    }

    public void say(String info) {
        System.out.println(name + ":" + info);
    }

    public void say(String name, int sum) {
        for (int i = 0; i < sum; i++) {
            System.out.println(name + ":" + sum);
        }
    }

    private void hehe(){
        System.out.println(name+":这就是我的私有方法...");
    }

    @Override
    public String toString() {
        return "Person{" +
                "name='" + name + '\'' +
                ", age=" + age +
                '}';
    }
}
